package com.yuanfeng.job.job;

import com.yuanfeng.job.dto.ForSettleShopInfoDTO;
import com.yuanfeng.job.mapper.ForSettleShopMapper;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @ClassName SettleAccountsJob
 * @Description 结算单
 * @Author liulh
 * @Date 2023/5/17 16:05
 * @Version 1.0
 **/
public class SettleAccountsJob implements BaseJob {

    @Autowired
    private SettleAccountsServices settleAccountsServices;

    @Autowired
    private ForSettleShopMapper forSettleShopMapper;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        System.out.println("开始执行SettleAccountsJob");
        List<ForSettleShopInfoDTO> settleShopInfos = forSettleShopMapper.getForSettleShopInfo();
        for (ForSettleShopInfoDTO settleShopInfo : settleShopInfos) {
            //单个进行结算
            settleAccountsServices.settleAccounts(settleShopInfo);
        }
    }
}
